package com.jb.repair.acticity;

/*
  @author cuixu
 *
 * 创建时间  2016/4/15
 *
 * 设置提醒时间，到时间若有未上传数据则弹出提醒
 */

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.os.Vibrator;
import android.widget.Toast;

public class AlarmAlert extends Activity {
    private Vibrator vibrator;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //获取震动
        vibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE);
        //设置提醒的时间					1	       2	     3		   4	     5
        vibrator.vibrate(new long[]{0, 60000, 0, 60000, 0, 60000, 0, 60000, 0, 60000}, -1);
        new AlertDialog.Builder(AlarmAlert.this)
                .setTitle("提醒")
                .setMessage("有未上传的数据，请尽快上传")
                .setPositiveButton("关闭提醒",
                        new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog,
                                                int whichButton) {
                                Toast.makeText(getApplication(), "canclel", Toast.LENGTH_SHORT);
                                vibrator.cancel();
                                AlarmAlert.this.finish();
                            }
                        }).show();

    }

}
